#pragma

#include <iostream>
#include <vector>
#include <ctime>

typedef void (*task_t)();

void PrintLog()
{
    std::cout << "这是一个打印日志任务" << std::endl;
}

void DownLoad()
{
    std::cout << "这是一个下载任务" << std::endl;
}

void UpLoad()
{
    std::cout << "这是一个上传任务" << std::endl;
}

class TaskManager{
public:
    TaskManager()
    {
        srand(time(nullptr));
    }

    void Register(task_t t)
    {
        tasks.push_back(t);
    }

    int Code()
    {
        return rand() % tasks.size();
    }

    void Excute(int code){
        if(code >= 0 && code < tasks.size())
            tasks[code]();
    }

    ~TaskManager()
    {

    }

private:
    std::vector<task_t> tasks;
};